<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>精研 3.0 - FooTable</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">

    <link rel="shortcut icon" href="favicon.ico"> <link href="/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">

    <link href="/css/animate.min.css" rel="stylesheet">
    <link href="/css/style.min.css?v=4.0.0" rel="stylesheet"><base target="_blank">
    <!-- Sweet Alert -->
    <link href="/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <!-- 弹窗-->
    <script src="../../tanchuan/js/jquery-2.0.0.min.js"></script>
    <link href="../../tanchuan/css/displaystyle.css" rel="stylesheet" />
    <script src="../../tanchuan/js/syntaxhighlighter_3.0.83/shCore.js"></script>
    <script src="../../tanchuan/js/syntaxhighlighter_3.0.83/shBrushJScript.js"></script>
    <link href="../../tanchuan/js/syntaxhighlighter_3.0.83/styles/shCoreRDark.css" rel="stylesheet" />
    <script src="../../tanchuan/js/NZ-Plugin/Js/NZ-Window.min.js"></script>
    <link href="../../tanchuan/js/NZ-Plugin/Css/NZ-Window.min.css" rel="stylesheet" />
    <script src="../../tanchuan/js/NZ-Plugin/Js/NZ-Drag.min.js"></script>
    <style>
        .clicked {
            color: red !important;
        }
    </style>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h1 style="font-family:arial;color: red">
                        商品详情数据  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <button onclick="openSelectedLinks()" class="btn btn-primary">打开选中的链接1</button>
                    </h1>
                    <div class="ibox-tools">
                    </div>
                </div>
                <br class="ibox-content">

                <table class="footable table table-stripped toggle-arrow-tiny" data-page-size="100">
                    <thead>
                    <tr style="font-family:arial;font-size:18px;">
                        <th><input type="checkbox" id="select-all"></th> <!-- 全选列 -->
                        <th >评分</th>
                        <th >位置</th>
                        <th >主页</th>
                        <th >出售商品数量</th>
                        <th >注册时间</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr class="gradeX" th:each="tag,resultStat:${detailList}">
                        <td><input type="checkbox" class="row-checkbox"></td> <!-- 单选框列 -->
                        <td th:text="${tag.score}"  style="font-family:arial;font-size:20px;"></td>
                        <td th:text="${tag.localStation}"  style="font-family:arial,serif;font-size:20px"></td>
                        <td>
                            <a th:href="${tag.homePage}"
                               target="_blank"
                               class="home-page-link"
                               style="font-family:arial;font-size:20px; text-decoration: none; color: #0000EE;"
                               onclick="this.classList.toggle('clicked'); return true;">
                                <span th:text="${tag.homePageName}"></span>
                                <i class="fa fa-external-link-square" style="margin-left: 5px;"></i>
                            </a>
                        </td>
                        <td th:text="${tag.soldGoods}"  style="font-family:arial;font-size:20px; color: green"></td>
                        <td th:text="${tag.regTime}"  style="font-family:arial;font-size:20px; color: green"></td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<!--    <script src="/js/jquery.min.js?v=2.1.4"></script>-->
<!--    <script src="/js/bootstrap.min.js?v=3.3.5"></script>-->
<script src="/js/plugins/footable/footable.all.min.js"></script>
<!--    <script src="/js/content.min.js?v=1.0.0"></script>-->

<!--    <script src="/js/jquery.min.js?v=2.1.4"></script>-->
<script src="/js/bootstrap.min.js?v=3.3.5"></script>
<script src="/js/plugins/sparkline/jquery.sparkline.min.js"></script>
<script src="/js/plugins/peity/jquery.peity.min.js"></script>
<script src="/js/content.min.js?v=1.0.0"></script>
<script src="/js/demo/peity-demo.min.js"></script>
<script src="/js/plugins/gritter/jquery.gritter.min.js"></script>
<script src="/js/plugins/sweetalert/sweetalert.min.js"></script>
<script>
    $(document).ready(function(){$(".footable").footable();$(".footable2").footable()});
</script>

<script>

    $(document).ready(function() {
        $(".footable").footable();
        $(".footable2").footable();

        // 绑定按钮点击事件
        $('#openLinksBtn').on('click', function() {
            // 获取所有选中的复选框
            const checkboxes = $('.row-checkbox:checked');

            // 调试信息：显示选中的复选框数量
            console.log(`检测到 ${checkboxes.length} 个选中的条目`);
            if (checkboxes.length === 0) {
                swal("提示", "请先选择要打开的链接！", "info");
                return;
            }

            // 收集有效链接元素
            const validLinks = [];
            checkboxes.each((index, checkbox) => {
                const $tr = $(checkbox).closest('tr.gradeX');
                const $link = $tr.find('a.home-page-link');

                // 验证链接有效性
                if ($link.length && $link[0] instanceof HTMLAnchorElement) {
                    validLinks.push($link[0]);
                } else {
                    console.warn(`第 ${index + 1} 个复选框对应的链接无效`);
                }
            });

            // 调试信息：显示有效链接数量
            console.log(`找到 ${validLinks.length} 个有效链接`);
            if (validLinks.length === 0) {
                swal("错误", "未找到可打开的有效链接！", "error");
                return;
            }

            // 延迟执行确保UI响应
            validLinks.forEach((link, index) => {
                setTimeout(() => {
                    try {
                        // 创建模拟点击事件
                        const clickEvent = new MouseEvent('click', {
                            bubbles: true,
                            cancelable: true,
                            view: window,
                            ctrlKey: true  // 模拟Ctrl键打开新标签页
                        });

                        // 执行点击操作
                        const isOpened = link.dispatchEvent(clickEvent);

                        // 添加视觉反馈
                        if (isOpened) {
                            $(link).addClass('link-opened');
                            console.log(`成功打开第 ${index + 1} 个链接`);
                        } else {
                            console.error(`第 ${index + 1} 个链接打开失败`);
                        }
                    } catch (error) {
                        console.error('处理第 ${index + 1} 个链接时出错:');
                            swal("错误", '处理链接时发生错误: ${error.message}', "error");
                        }
                    }, index * 200); // 延迟队列控制
                });

                // 提示用户操作完成
                setTimeout(() => {
                    swal("完成", "所有有效链接已尝试打开！", "success");
                }, validLinks.length * 200 + 500);
            });

            // 全选功能
            $('#select-all').click(function() {
                $('.row-checkbox').prop('checked', this.checked);
            });
        });

    function stockMinutes30(object){
        var code=object.id;
        $.NZ_Window.show({
            url: '/stockMinutes30?code='+code,
            width: 1500,
            height: 1000,
            operate: {
                btn_Close: true, //关闭按钮
                btn_Max: true, //最大化按钮
                btn_Refresh: true, //刷新按钮
                btn_NewWindow: true, //新窗口按钮
                resize: true //调整窗口大小按钮
            }
        });
        // window.open('/stockMinutes?code='+code,'','width=2000,height=1000,left=200,top=300,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');
    }


    function stockReDianKan24Hour(object){
        var code=object.id;
        $.NZ_Window.show({
            url: '/ths/stockKanDian?type=24Hour&code='+code,
            width: 1500,
            height: 1000,
            operate: {
                btn_Close: true, //关闭按钮
                btn_Max: true, //最大化按钮
                btn_Refresh: true, //刷新按钮
                btn_NewWindow: true, //新窗口按钮
                resize: true //调整窗口大小按钮
            }
        });
        // window.open('/stockMinutes?code='+code,'','width=2000,height=1000,left=200,top=300,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');
    }

    function showImage(objec){
        $.NZ_Window.show({
            url: objec,
            width: 700,
            height: 1200,
            operate: {
                btn_Close: true, //关闭按钮
                btn_Max: true, //最大化按钮
                btn_Refresh: true, //刷新按钮
                btn_NewWindow: true, //新窗口按钮
                resize: true //调整窗口大小按钮
            }
        });
        // window.open('/stockMinutes?code='+code,'','width=2000,height=1000,left=200,top=300,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');
    }
    function showImageZhuanZhang(objec){
        var userName=objec.userName;
        var date=objec.date;
        $.NZ_Window.show({
            url: '/zy/showImage?userName='+userName+'&date='+date+'&type='+'C',
            width: 700,
            height: 1200,
            operate: {
                btn_Close: true, //关闭按钮
                btn_Max: true, //最大化按钮
                btn_Refresh: true, //刷新按钮
                btn_NewWindow: true, //新窗口按钮
                resize: true //调整窗口大小按钮
            }
        });
        // window.open('/stockMinutes?code='+code,'','width=2000,height=1000,left=200,top=300,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');
    }


    function showTag(url){
        var url=url.innerHTML;
         window.open(url);
    }

    function modifyUserInfo(object){
        var username=object.id;
        $.NZ_Window.show({
            url: "/zy/queryUserByIdName?userName="+username,
            width: 1500,
            height: 1000,
            operate: {
                btn_Close: true, //关闭按钮
                btn_Max: true, //最大化按钮
                btn_Refresh: true, //刷新按钮
                btn_NewWindow: true, //新窗口按钮
                resize: true //调整窗口大小按钮
            }
        });
        // window.open('/stockMinutes?code='+code,'','width=2000,height=1000,left=200,top=300,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');
    }
</script>
</body>

</html>